home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CUJ9204.ARJ / 1004090C < prev    next >
Text File  |  1992-06-02  |  321b  |  20 lines

  1.  
  2. void push(stack *st, int value)
  3. {
  4.     if (st->stack_ptr == st->max_stack)
  5.         printf("Stack %s is full\n", st->stack_name);
  6.     else
  7.         st->pstack[st->stack_ptr++] = value;
  8. }
  9.  
  10. int pop(stack *st)
  11. {
  12.     if (st->stack_ptr == 0) {
  13.         printf("Stack %s is empty\n", st->stack_name);
  14.         return 0;
  15.     }
  16.  
  17.     return st->pstack[--st->stack_ptr];
  18. }
  19.  
  20.